import {ref} from 'vue'
import {defineStore} from 'pinia'
import type {ILoginResponse} from "@/types";

export const useUserInfoStore = defineStore('userInfo', () => {
  const userInfo = ref<ILoginResponse | null>();

  function setUserInfo(data: ILoginResponse) {
    userInfo.value = data
  }

  function clearUserInfo() {
    userInfo.value = null
  }

  return {userInfo, setUserInfo, clearUserInfo}
}, {
  persist: true
})
